package com.bdbit.ChargingStation.dao;

import com.bdbit.ChargingStation.entity.ChargingOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
public interface ChargingOrderDao {
    int insert(ChargingOrder order);
    int update(ChargingOrder order);
    int delete(Long id);
    ChargingOrder findById(Long id);
    List<ChargingOrder> findAll();
    List<ChargingOrder> findByUserId(String userId);
    List<ChargingOrder> findByStatus(Integer status);
    List<ChargingOrder> findActiveOrders();
    List<ChargingOrder> findAllWithDateRange(Date startDate, Date endDate);
    List<ChargingOrder> findByUserIdWithDateRange(String userId, Date startDate, Date endDate);
    List<ChargingOrder> findByStatusWithDateRange(Integer status, Date startDate, Date endDate);
    List<ChargingOrder> findByRegionAndEleCode(String regionCode, String eleCode);

    int updateStatus(Long id, Integer status);

    int logicalDelete(Long id);

    // XML查询方法
    List<ChargingOrder> searchOrders(Map<String, Object> params);

    List<ChargingOrder> searchOrders(Map<String, Object> params, int offset, int size);

    long countSearchOrders(Map<String, Object> params);
}